package com.young.springdemo.jpa.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.young.springdemo.config.DateSerializer;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * @program: springdemo
 * @description 红名单限制人员
 * @author: Young
 * @create: 2020-05-31 15:15
 **/
@Entity
@Table(name = "red_teacher")
public class RedTeacherEntity {
    private int id;
    private String redTeacher;
    private String limitDesc;
    @JsonSerialize(using = DateSerializer.class)
    private Timestamp createTime;

    @Id
    @Column(name = "id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "red_teacher")
    public String getRedTeacher() {
        return redTeacher;
    }

    public void setRedTeacher(String redTeacher) {
        this.redTeacher = redTeacher;
    }

    @Basic
    @Column(name = "limit_desc")
    public String getLimitDesc() {
        return limitDesc;
    }

    public void setLimitDesc(String limitDesc) {
        this.limitDesc = limitDesc;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        RedTeacherEntity that = (RedTeacherEntity) o;

        if (id != that.id) return false;
        if (redTeacher != null ? !redTeacher.equals(that.redTeacher) : that.redTeacher != null) return false;
        if (limitDesc != null ? !limitDesc.equals(that.limitDesc) : that.limitDesc != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (redTeacher != null ? redTeacher.hashCode() : 0);
        result = 31 * result + (limitDesc != null ? limitDesc.hashCode() : 0);
        return result;
    }
}
